#pragma once
#include <QDialog>
#include <QLineEdit>
#include <QPushButton>
#include <QLabel>
#include <QTimer>
#include <QShowEvent>
#include <QCloseEvent>
#include "Keyboard/KeyboardManager.h"

using namespace AeaQt;

class AdminDialog : public QDialog
{
    Q_OBJECT

public:
    explicit AdminDialog(QWidget *parent = nullptr);
    virtual ~AdminDialog();

protected:
    // 重写显示事件，确保键盘显示
    void showEvent(QShowEvent *event) override;

    // 重写关闭事件，确保归还键盘
    void closeEvent(QCloseEvent *event) override;

private:
    QLineEdit *userEdit;
    QLineEdit *pwdEdit;
    Keyboard *keyboard;
    QLabel *statusLabel;
    QPushButton *loginBtn;

    // 防抖相关
    bool keyProcessing;
    QTimer *debounceTimer;
};